<template>
  <div>
    <p>买的数量：{{count}}</p>
    <button v-on:click="count=count+1">增加1</button>
    <button v-on:click="count=count+5">增加5</button>
    <br><hr>
    <button v-on:click="addFn">增加1</button>
    <button v-on:click="addCountFn(5)">+5</button>

    <hr>
    <button @click="subFn(-1)"> 减少</button>
  </div>
</template>

<script>

export default {
  data(){
    return{
           count:0
    }
  },
  methods:{
    addFn(){
      this.count++
    },
    addCountFn(num){
      this.count = this.count + num
    },
    subFn() {
      this.count = this.count-1
    }
  }
}
</script>

<style>

</style>
